﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="FrmComprobanteVenta.aspx.cs" Inherits="UI.Tesoreria.FrmComprobanteVenta" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script language="javascript" type="text/javascript">
        function AbrirVentana(url) {
            window.location(url);
        }
    </script>
    <style type="text/css">

         .styleCOntrolIngreso
        {
            width: 60px;
            height: 26px;
        }
                        
        .styleLabel
        {
            width: 134px;
            height: 26px;
        }
         .style4
        {
            /*background: url(Administration/Images/Grey/captionbckg.gif) repeat-x;*/
        background: #f9f9f9 url('../Imagenes/grey/captionbckg.gif') repeat-x;
            color: #333333;
            text-align: left;
            font-size: 11px;
            font-weight: bold;
            padding-top: 4px;
            padding-left: 4px;
            font-family: tahoma,arial,verdana,sans-serif;
            height: 30px;
        }
        .style2
        {
            height: 25px;
        }
                
         .style42
        {
            height: 25px;
            width: 134px;
        }
        .style48
        {
            /*background: url(Administration/Images/Grey/captionbckg.gif) repeat-x;*/
   /* background: #f9f9f9 url('../Imagenes/grey/captionbckg.gif') repeat-x;*/
        text-align: left;
            padding-top: 4px;
            padding-left: 4px;
            height: 18px;
        }
        .style49
        {
            width: 11px;
            height: 18px;
        }
        .style51
        {
            /*background: url(Administration/Images/Grey/captionbckg.gif) repeat-x;*/
   /* background: #f9f9f9 url('../Imagenes/grey/captionbckg.gif') repeat-x;*/
        color: #333333;
            text-align: left;
           
            font-size: 11px;
            font-weight: bold;
            padding-top: 4px;
            padding-left: 4px;
            font-family: tahoma,arial,verdana,sans-serif;
            height: 18px;
            width: 126px;
        }
                
         .style52
        {
            /*background: url(Administration/Images/Grey/captionbckg.gif) repeat-x;*/
   /* background: #f9f9f9 url('../Imagenes/grey/captionbckg.gif') repeat-x;*/
        color: #333333;
            text-align: left;
            font-size: 11px;
            font-weight: bold;
            padding-top: 4px;
            padding-left: 4px;
            font-family: tahoma,arial,verdana,sans-serif;
            width: 134px;
        }
        .style56
        {
            /*background: url(Administration/Images/Grey/captionbckg.gif) repeat-x;*/
   /* background: #f9f9f9 url('../Imagenes/grey/captionbckg.gif') repeat-x;*/
        color: #333333;
            text-align: left;
            font-size: 11px;
            font-weight: bold;
            padding-top: 4px;
            padding-left: 4px;
            font-family: tahoma,arial,verdana,sans-serif;
            width: 126px;
        }
        .style57
        {
            height: 25px;
            width: 126px;
        }
        .style58
        {
            width: 11px;
        }
        .style59
        {
            /*background: url(Administration/Images/Grey/captionbckg.gif) repeat-x;*/
   /* background: #f9f9f9 url('../Imagenes/grey/captionbckg.gif') repeat-x;*/
    /*color: #333333;*/
        text-align: left; /*line-height: 0px;*/;
            font-size: 11px; /*font-weight: bold;*/ /*padding-top: 4px;
    padding-left: 4px;*/;
            font-family: tahoma,arial,verdana,sans-serif;
            width: 160px;
        }
        .style60
        {
            width: 160px;
        }
        .style63
        {
            width: 6px;
        }
        #TextArea1
        {
            width: 310px;
            height: 45px;
        }
        .style78
        {
            width: 3979px;
        }
        .style79
        {
            width: 3px;
        }
                
         .style80
        {
            height: 39px;
        }
                
         </style>
</asp:Content>
<asp:Content onkeydown = "return (event.keyCode!=13)" ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:UpdatePanel ID="panelActualizar" UpdateMode="Always" runat="server">
        <Triggers>
            <asp:PostBackTrigger ControlID="btnGuardarCpVenta" />
        </Triggers>
        <ContentTemplate>
            <table style="width: 60%;">
                <tr>
                    <td class="style78">
                        &nbsp;
                        <asp:ImageButton ID="ImageButton5" runat="server" ImageUrl="~/Imagenes/Iconos/new.png"
                            OnClick="ImageButton5_Click" Style="width: 48px" />
                    </td>
                    <td class="style79">
                        <asp:ImageButton ID="ImageButton4" runat="server" ImageUrl="~/Imagenes/Iconos/back.png"
                            OnClick="ImageButton4_Click" Style="width: 48px" />
                    </td>
                    <td>
                        <asp:ImageButton ID="btnGuardarCpVenta" runat="server" ImageUrl="~/Imagenes/Iconos/accept.png"
                            OnClick="btnGuardarCpVenta_Click" />
                    </td>
                </tr>
            </table>
            <table frame="border" style="width: 905px">
                <tr>
                    <td class="style4" colspan="5">
                        DATOS GENERALES
                    </td>
                </tr>
                <tr>
                    <td class="style56">
                        TIPO COMPROBANTE
                    </td>
                    <td class="style59">
                        <asp:DropDownList runat="server" Height="18px" Width="233px" ID="ComboTipoDocumento"
                            AutoPostBack="True" OnSelectedIndexChanged="ComboTipoDocumento_SelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                    <td class="style58">
                        &nbsp;
                    </td>
                    <td class="style52">
                        N° COMPROBANTE
                    </td>
                    <td class="filaTablaBlanco">
                        <asp:TextBox runat="server" CssClass="textEntry" Height="19px" ID="txtCodigo0" Enabled="False"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style56">
                        <asp:Label runat="server" Text="CLIENTE REFERENCIAL" ID="Label6"></asp:Label>
                    </td>
                    <td class="style59">
                        <asp:CheckBox ID="CheckClienteReferencial" runat="server" AutoPostBack="True" OnCheckedChanged="CheckClienteReferencial_CheckedChanged" />
                    </td>
                    <td class="style58">
                        &nbsp;
                    </td>
                    <td class="style52">
                        FECHA DE DOCUMENTO
                    </td>
                    <td class="filaTablaBlanco">
                        <asp:TextBox ID="txtFechaDocumento" runat="server"></asp:TextBox>
                        <asp:CalendarExtender ID="txtFechaDocumento_CalendarExtender" runat="server" Enabled="True"
                            Format="dd/MM/yyyy" TargetControlID="txtFechaDocumento">
                        </asp:CalendarExtender>
                    </td>
                </tr>
                <tr>
                    <td class="style51">
                        <asp:Label runat="server" Text="NOMBRE CLIENTE" ID="Label7"></asp:Label>
                    </td>
                    <td class="style59">
                        <asp:TextBox runat="server" CssClass="textEntry" Height="19px" Width="319px" ID="txtNombreCliente"
                            Enabled="False"></asp:TextBox>
                    </td>
                    <td class="style49">
                        <asp:ImageButton ID="btnBuscarAlumno" runat="server" Height="22px" ImageUrl="~/Imagenes/Iconos/search.png"
                            Width="28px" OnClick="btnBuscarAlumno_Click" />
                    </td>
                    <td class="style52">
                        PERIODO
                    </td>
                    <td class="style48">
                        <asp:DropDownList runat="server" Height="18px" Width="210px" ID="ComboPeriodo">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="style57">
                        <asp:Label runat="server" Text="LICENCIA" ID="lblLicencia"></asp:Label>
                        <asp:CheckBox ID="chkLicencia" runat="server" AutoPostBack="True" OnCheckedChanged="chkLicencia_CheckedChanged" />
                        <asp:Label runat="server" ID="labelID" Visible="False" ForeColor="Red"></asp:Label>
                    </td>
                    <td class="style60">
                        <asp:Label ID="labelErrorCp" runat="server" ForeColor="Red" Font-Bold="True" Font-Overline="True"
                            Font-Size="Larger"></asp:Label>
                        <asp:Label ID="lblErrorValida" runat="server" ForeColor="Red"></asp:Label>
                    </td>
                    <td class="style58">
                        &nbsp;
                    </td>
                    <td class="style42">
                        &nbsp;
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                </tr>
            </table>
            </p>
            <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="299px"
                Width="80%">
                <asp:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1">
                    <HeaderTemplate>
                        PRODUCTOS Y SERVICIOS</HeaderTemplate>
                    <ContentTemplate>
                        <table style="width: 100%;">
                            <tr>
                                <td class="style63">
                                    &nbsp;
                                </td>
                                <td>
                                    <asp:ImageButton ID="btnAgregarItem" runat="server" Height="26px" ImageUrl="~/Imagenes/Iconos/add_to_shopping_cart.png"
                                        Width="28px" OnClick="btnAgregarItem_Click" />
                                    <asp:ImageButton ID="btnAgregarDeuda" runat="server" Height="26px" ImageUrl="~/Imagenes/Iconos/add_user.png"
                                        OnClick="btnAgregarDeuda_Click" Width="28px" />
                                </td>
                            </tr>
                        </table>
                        <br />
                        <asp:GridView ID="GridDetalle" runat="server" Width="877px" AutoGenerateColumns="False"
                            OnRowDataBound="GridView1_RowDataBound" DataKeyNames="id,IDDeuda" OnLoad="GridDetalle_Load"
                            OnRowDeleting="GridDetalle_RowDeleting" OnRowDeleted="GridDetalle_RowDeleted"
                            OnSelectedIndexChanged="GridDetalle_SelectedIndexChanged" OnSelectedIndexChanging="GridDetalle_SelectedIndexChanging">
                            <Columns>
                                <asp:TemplateField HeaderText="Concepto">
                                    <ItemTemplate>
                                        <%--    <asp:Label ID="Label1" Text='<%#Eval("Concepto") %>' runat="server">
                                </asp:Label>--%>
                                        <asp:TextBox ID="txtConcepto" runat="server" Visible="false" Text='<%#Eval("Concepto") %>'
                                            Width="70px">
                                        </asp:TextBox>
                                        <asp:DropDownList ID="comboConceptosItem" AutoPostBack="true" runat="server" Width="270px"
                                            OnSelectedIndexChanged="onComboConceptosSelected">
                                            <asp:ListItem Value="00">--Selecciones--</asp:ListItem>
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Concepto" HeaderText="Concepto" Visible="False">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="Pago En Cuotas">
                                    <ItemTemplate>
                                        <asp:CheckBox AutoPostBack="true" ID="checkPagoCuotas" runat="server" Checked='<%#Eval("checkPagoCuotas") %>'
                                            Width="70px"></asp:CheckBox>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="checkPagoCuotas" HeaderText="checkPagoCuotas" Visible="False">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="Monto">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtMonto" runat="server" Text='<%#Eval("Monto") %>' Width="70px">
                                        </asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Monto" HeaderText="Monto" Visible="False">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="Pago Total">
                                    <ItemTemplate>
                                        <asp:CheckBox AutoPostBack="true" ID="checkPagoTotal" runat="server" Checked='<%#Eval("checkPagoTotal") %>'
                                            Width="70px" OnCheckedChanged="chk_OnCheckedMonto"></asp:CheckBox>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="checkPagoTotal" HeaderText="checkPagoTotal" Visible="False">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="Monto Pagado">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtMontoPagado" runat="server" Text='<%#Eval("MontoPagado") %>'
                                            Width="80px" DataFormatString="##,##.00">
                                        </asp:TextBox></ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Observacion">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtObservacion" runat="server" Text='<%#Eval("Observacion") %>'
                                            Width="260px">
                                        </asp:TextBox></ItemTemplate>
                                </asp:TemplateField>
                                <asp:CommandField SelectText="ELIMINAR" ShowSelectButton="True" InsertImageUrl="~/Imagenes/Iconos/back.png" />
                                <asp:BoundField DataField="id" HeaderText="id" Visible="False" />
                                <asp:BoundField DataField="IDDeuda" HeaderText="IDDeuda" Visible="False" />
                            </Columns>
                        </asp:GridView>
                        <br />
                        <br />
                        <br />
                    </ContentTemplate>
                </asp:TabPanel>
            </asp:TabContainer>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:Panel ID="PanelAgregarAlumno" runat="server" Style="text-align: center">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <Triggers>
                <asp:PostBackTrigger ControlID="grvAgregaAlumnos" />
            </Triggers>
            <ContentTemplate>

            
                <table class="BTabla">
                    <tr>
                        <td class="filaTabla" colspan="4">
                            Búsqueda de Alumnos
                        </td>
                    </tr>
                    <tr>
                        <td class="style31">
                        </td>
                        <td class="style29">
                        </td>
                        <td class="style21">
                        </td>
                        <td class="style30">
                        </td>
                    </tr>
                    <tr>
                        <td class="style80">
                            &nbsp;
                        </td>
                        <td class="style80">
                            Codigo/ Apellido y Nombre:
                        </td>
                        <td class="style80">
                            <asp:TextBox onkeydown = "return (event.keyCode!=13);" ID="txtModalCodigo" runat="server" Width="155px"></asp:TextBox>
                        </td>
                        <td style="text-align: left; margin-left: 40px;" class="style80">
                            <asp:Button ID="btnBuscarModal" runat="server" Height="35px" Text="Buscar" Width="90px"
                                OnClick="btnBuscarModal_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td class="style31">
                            &nbsp;
                        </td>
                        <td class="style24" colspan="3">
                            <asp:Label ID="lblMensajeModal" runat="server" Style="color: #FF0000"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="style31" colspan="4">
                            <asp:GridView ID="grvAgregaAlumnos" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                OnSelectedIndexChanged="grvAgregaAlumnos_SelectedIndexChanged" Width="622px"
                                OnPageIndexChanging="grvAgregaAlumnos_PageIndexChanging" PageSize="25">
                                <Columns>
                                    <asp:CommandField SelectText="Agregar" ShowSelectButton="True" />
                                    <asp:BoundField DataField="codigo" HeaderText="Código">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="nombres" HeaderText="Nombres">
                                        <ItemStyle HorizontalAlign="Left" />
                                    </asp:BoundField>
                                </Columns>
                            </asp:GridView>
                        </td>
                    </tr>
                </table>

            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:Button ID="btnSalir" runat="server" Height="33px" OnClick="btnSalir_Click" Text="Salir"
            Width="86px" />
    </asp:Panel>
    <asp:Panel ID="PanelDeuda" runat="server" Style="text-align: center">
        <asp:UpdatePanel ID="UpdatePanel2" runat="server" OnDisposed="UpdatePanel2_Disposed"
            OnInit="UpdatePanel2_Init" OnLoad="UpdatePanel2_Load" OnPreRender="UpdatePanel2_PreRender"
            OnUnload="UpdatePanel2_Unload">
            <Triggers>
                <asp:PostBackTrigger ControlID="GridDeudas" />
            </Triggers>
            <ContentTemplate>
                <table class="BTabla">
                    <tr>
                        <td class="filaTabla" colspan="2">
                            Búsqueda de Deudas
                        </td>
                    </tr>
                    <tr>
                        <td class="style31">
                            &nbsp;
                        </td>
                        <td class="style24">
                            <asp:Label ID="Label1" runat="server" Style="color: #FF0000"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="style31" colspan="2">
                            <asp:GridView ID="GridDeudas" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                OnSelectedIndexChanged="GridDeudas_SelectedIndexChanged" Width="622px" DataKeyNames="Id_Concepto,ID_Deuda">
                                <Columns>
                                    <asp:CommandField SelectText="Agregar" ShowSelectButton="True" />
                                    <asp:BoundField DataField="Alumno" HeaderText="Alumno">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Id_Concepto" HeaderText="Id_Concepto" Visible="False">
                                        <ItemStyle HorizontalAlign="Left" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Descripcion" HeaderText="Descripcion" />
                                    <asp:BoundField DataField="MontoTotal" HeaderText="MontoTotal" />
                                    <asp:BoundField DataField="Monto_Pagado" HeaderText="MontoPagado" />
                                    <asp:BoundField DataField="Saldo" HeaderText="Saldo" />
                                    <asp:BoundField DataField="ID_Deuda" HeaderText="ID_Deuda" Visible="False" />
                                </Columns>
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
                <asp:Button ID="ButtonSalirDeuda" runat="server" Height="33px" Text="Salir" Width="86px"
                    OnClick="ButtonSalirDeuda_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>
    <asp:HiddenField ID="HiddenFiel1" runat="server" />
    <asp:ModalPopupExtender ID="mpeAgregaAlumno" runat="server" PopupControlID="PanelAgregarAlumno"
        TargetControlID="HiddenFiel1" BackgroundCssClass="modalBackground">
    </asp:ModalPopupExtender>
    <asp:HiddenField ID="HiddenField2" runat="server" />
    <asp:ModalPopupExtender ID="agregarDeuda" runat="server" PopupControlID="PanelDeuda"
        TargetControlID="HiddenField2" BackgroundCssClass="modalBackground">
    </asp:ModalPopupExtender>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="panelActualizar"
        DisplayAfter="0">
        <ProgressTemplate>
            <div style="background-color: Gray; filter: alpha(opacity=60); opacity: 0.60; width: 100%;
                top: 0px; left: 0px; position: fixed; height: 100%;">
            </div>
            <div style="margin: auto; font-family: Trebuchet MS; filter: alpha(opacity=100);
                opacity: 1; font-size: small; vertical-align: middle; top: 45%; position: fixed;
                right: 45%; color: #275721; text-align: center; background-color: White; height: 100px;
                bottom: 296px;">
                <table style="background-color: White; font-family: Sans-Serif; text-align: center;
                    border: solid 1px #275721; color: #275721; width: inherit; height: inherit; padding: 15px;">
                    <tr>
                        <td style="text-align: inherit;">
                            <img src="../Imagenes/Gif/cargando.gif" alt="Loading" />
                        </td>
                        <td style="text-align: inherit;">
                            <span style="font-family: Sans-Serif; font-size: medium; font-weight: bold; font">Cargando...</span>
                        </td>
                    </tr>
                </table>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</asp:Content>
